package com.young.api;

import com.github.pagehelper.PageInfo;
import com.young.annot.Log;
import com.young.req.SysLogPageReq;
import com.young.res.SysLogPageRes;
import com.young.shop.service.SysLogService;
import io.swagger.annotations.ApiOperation;
import javax.annotation.security.PermitAll;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description: 操作日志相关Api
 * @Author: kangyang
 * @Date: 2021/5/19 21:59
 **/
@RestController
@RequestMapping("/sys/log")
public class SysLogController {

  @Autowired
  private SysLogService sysLogService;

  @GetMapping("/page")
  @ApiOperation("分页查询日志")
  @Log(name = "分页查询日志")
  @RequiresPermissions("sys:log:page")
  public ResponseEntity<PageInfo<SysLogPageRes>> pageLog(SysLogPageReq sysLogPageReq) {
    PageInfo<SysLogPageRes> sysLogPageResPageInfo = sysLogService.getSysLogPageInfo(sysLogPageReq);
    return ResponseEntity.ok(sysLogPageResPageInfo);
  }

}
